#ifndef _DKGL_LIGHT_H_
#define _DKGL_LIGHT_H_

#include "dkglObject.h"

#define g_LightMgr			LightManager::GetSingleton()
#define g_LightMgrPtr		LightManager::GetSingletonPtr()

namespace DKGL
{

class LightManager;

class Light : public BaseObject
{
public:
	/** Enable the lighting */
	Light& enable(bool b = true);

	virtual void render();
	virtual void drawEntity();

	/** Set the ambient property of the light */
	Light& setAmbient(const Colorf& amb);
	/** Set the diffuse property of the light */
	Light& setDiffuse(const Colorf& color);
	/** Set the specular property of the light */
	Light& setSpecular(const Colorf& color);

	/** It is no use at the present */
	inline Light& setLightType(LIGHT_TYPE type)
	{
		mType = type;
		return *this;
	};

private:
	inline Light()
	{
		mType = LT_POINT;
	};

	~Light(){};

	void _initParam();
	
	LIGHT_TYPE mType;
	bool mBeEnable;
	
	int mID;
	GLfloat mAmbient[4], mDiffuse[4], mSpecular[4]; 
	float m_fSize;

friend class LightManager;
};

class LightManager : public Singleton<LightManager>
{
public:
	inline LightManager()
	{
		_initLightID();
	};

	~LightManager(){};

	inline Light& getLight(unsigned short id = 0)
	{return mLight[id];};

private:
	void _initLightID(void);
	Light mLight[8];
};
}

#endif